﻿@model CandidateManager.Areas.Coach.Models.CandidateAssignModel

@{
    ViewBag.Title = "Assign To Candidates";
}

<h2>Assign no Candidates</h2>

@using (Html.BeginForm("AssignToCandidates", "Homeworks", new { @TaskId = Model.Task.Id }, FormMethod.Post))
{
    @Html.ValidationSummary(true)
        
    <table class="bordered">
     <thead>
        <tr>
            <th></th>
            <th>Candidate Name</th>
            <th>Group Name</th>
        </tr>
    </thead>
    @for (int c = 0; c < Model.CandidateCheckList.Count; c++)
    {
        @Html.HiddenFor(model => model.CandidateCheckList[c].CandidateId)
        <tr>
            <td>@Html.EditorFor(model => model.CandidateCheckList[c].IsChecked)</td>
            <td>@Model.CandidateCheckList[c].Candidate.FullName</td>
            <td>@Model.CandidateCheckList[c].Candidate.StudyGroup.First(g => g.Couch.Any(co => co.Id == Model.Task.Owner.Id)).GroupName</td>
        </tr>        
    }
    </table>
    
    <p>
        @Html.ActionLink(@Resources.Common.CommonButtonCancel, "Assign", new { @HomeworkId = Model.Task.Id }, new { @class = "common-btn-large BlueColor" }) <input class="common-btn-large BlueColor" type="submit" value=@Resources.Common.CommonButtonSave />
    </p>
}